package oop;

public class Test_Employee {
    public static void main(String[] args) {
        Coder c = new Coder();
        c.setName("wzx");
        c.setId("123456");
        c.setSalary(12000);
        c.work();

        Manager m = new Manager();
        m.setName("zzz");
        m.setId("123456789");
        m.setSalary(18000);
        m.work();
    }
}

abstract class Employee {
    private String name;//姓名
    private String id;//工号
    private double salary;//工资

    public Employee() {
    }

    public Employee(String name, String id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getId() {
        return id;
    }
    public void setSalary(double salary) {
        this.salary = salary;
    }
    public double getSalary() {
        return salary;
    }


    //定义抽象方法
    public abstract void work();
}
class Coder extends Employee {
    public Coder() {
        super();
    }

    public Coder(String name, String id, double salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("我的姓名是："+this.getName()+"我的工号是："+this.getId()+
                "我的工资是："+this.getSalary()+"我的工作内容是敲代码");
    }
}

class Manager extends Employee {
    private int bonus;//奖金
    public Manager() {
    }

    public Manager(String name, String id, double salary,int bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }
    @Override
    public void work() {
        System.out.println("我的姓名是："+this.getName()+"我的工号是："+this.getId()+
                "我的工资是："+this.getSalary()+"我的奖金是："+bonus+"我的工作内容是管理");
    }

}

